<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Estados</title>
        <ui:include src="/WEB-INF/partials/layout/admin/includes.xhtml"/>
    </h:head>
    <h:body>
         <ui:include src="/WEB-INF/partials/layout/admin/menu.xhtml"/>

        <h:form>
            <h1><h:outputText value="Create/Edit"/></h1>
            <p:messages autoUpdate="true"/>
            <h:inputHidden id="id" value="#{EstadoCrudMB.entity.id}" title="Id" />
            <div align="center">
                <p:panelGrid columns="2">
                    <h:outputLabel value="Nome:" for="nome" />
                    <h:inputText id="nome" value="#{EstadoCrudMB.entity.nome}" title="Nome" />
                    <h:outputLabel value="Sigla:" for="sigla" />
                    <h:inputText id="sigla" value="#{EstadoCrudMB.entity.sigla}" title="Sigla" />
                    <h:outputLabel value="Pais:" for="pais" />

                    <p:selectOneMenu id="pais" value="#{EstadoCrudMB.entity.pais}" title="Pais" converter="PaisConverter">
                        <f:selectItems value="#{EstadoCrudMB.paises}" var="pais" itemLabel="#{pais.nome}" itemValue="#{pais}" rendered="true"/>
                    </p:selectOneMenu>


                    <f:facet name="footer"> 
                        <p:commandButton value="Voltar" onclick="window.location='./index.xhtml'"/>
                        <p:commandButton value="Salvar" action="#{EstadoCrudMB.save()}" />
                    </f:facet>
                </p:panelGrid>
            </div>
        </h:form>
    </h:body>
</html>
